package com.example.kakaotalk.datas;

import java.util.ArrayList;
import java.util.Date;

public class ChatRoom {
	private OnFriendAddedListener mAddedFriendListener;
	private OnFriendRemovedListener mRemovedFriendListener;
	
	private ArrayList<Friend> mFriends = new ArrayList<Friend>();
	private ArrayList<ChatRoomItem> mChatItems = new ArrayList<ChatRoomItem>();
	private Date mCreateTime;

	public ArrayList<Friend> getFriends() {
		return mFriends;
	}

	public ArrayList<ChatRoomItem> getChatItems() {
		return mChatItems;
	}

	public Date getmCreateTime() {
		return mCreateTime;
	}

	public void setCreateTime(Date mCreateTime) {
		this.mCreateTime = mCreateTime;
	}

	public void addFriend(Friend friend){
		mFriends.add(friend);
		if (mAddedFriendListener != null){
			mAddedFriendListener.addedFriend(friend);
		}
	}
	
	public void removeFriend(int index){
		Friend friend = mFriends.remove(index);
		if (mRemovedFriendListener != null){
			mRemovedFriendListener.addedFriend(friend);
		}
	}
	
	public void removeFriend(Friend friend){
		mFriends.remove(friend);
		if (mRemovedFriendListener != null){
			mRemovedFriendListener.addedFriend(friend);
		}
	}
	
	public void setOnAddedFriendListener(OnFriendAddedListener listener){
		mAddedFriendListener = listener;
	}
	
	public interface OnFriendAddedListener{
		public void addedFriend(Friend friend);
	}
	
	public void setOnRemovedFriendListener(OnFriendRemovedListener listener){
		mRemovedFriendListener = listener;
	}
	
	public interface OnFriendRemovedListener{
		public void addedFriend(Friend friend);
	}
}
